package com.orange.quickback.system.entities.user.manage;

import com.orange.quickback.system.entities.QBootObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "q_boot_role_menu")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class QBootRoleMenu extends QBootObject {
    private String pattern;
    @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
    @JoinTable(
            name = "q_boot_role_menu_q_boot_role",
            joinColumns = {
                    @JoinColumn(name = "menu_id",referencedColumnName="id") },
            inverseJoinColumns = {
                    @JoinColumn(name = "role_id",referencedColumnName="id") })
    List<QBootRole> qBootRoles;

    public QBootRoleMenu(String pattern) {
        this.pattern=pattern;
    }
}
